package com.financing.wap.common;

import java.util.HashMap;
import java.util.Map;

import org.codehaus.jackson.map.annotate.JsonSerialize;

/**
 * ajax 返回封装类
 * @author hetaihe
 */
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class ResultMap {
	
	public enum STATUS{
		SUCCESS,FAILE,ERROR,WARN,NEED_LOGIN,NEED_MEMBEER
	}

	private String statusCode;
	/**
	 * 状态
	 */
	private STATUS status = STATUS.FAILE;
	
	/**
	 * 提示语
	 */
	private String message="";
	
	/**
	 * 属性
	 */
	private Map<String, Object> attribute = new HashMap<String, Object>();
	
	
	/**
	 * 正常成功
	 */
	public static final String STATUS_CODE_SUCCESS = "0000";

	public static String STATUS_CODE_SAVE_FILE_DIR_ERROR = "0002";
	
	/**
	 * 上传文件类型异常
	 */
	public static String STATUS_CODE_FILE_TYPE_ERROR = "0003";
	
	/**
	 * 没有文件上传
	 */
	public static String STATUS_CODE_NO_FILE_UPLOAD = "0004";
	/**
	 * 网络异常
	 */
	public static final String STATUS_CODE_NETWORK_ERROR = "1001";
	/**
	 * 链接超时
	 */
	public static final String STATUS_CODE_TIMEOUT = "1002";
	/**
	 * 重复添加
	 */
	public static final String STATUS_CODE_REPEAT_LOSE = "1999";
	/**
	 * 未登录
	 */
	public static final String STATUS_CODE_ONLOGIN = "2001";
	/**
	 *未开通会员
	 */
	public static final String STATUS_CODE_ONMEMBER = "200100";
	/**
	 * 参数缺失
	 */
	public static final String STATUS_CODE_PARAMETERS_LOSE = "2002";
	
	
	/**
	 * 参数类型错误
	 */
	public static final String STATUS_CODE_PARAMETERS_TYPE_ERROR = "2003";
	/**
	 * 请求对象不存在
	 */
	public static final String STATUS_CODE_OBJECT_NOFOUNT = "2004";
	
	/**
	 * 身份认证不通过
	 */
	public static final String STATUS_CODE_AUTHENTICATION_ERROE = "2005";
	
	/**
	 * 违法操作
	 */
	public static final String STATUS_CODE_OPERATE_ERROE = "2006";
	
	/**
	 * 重名验证错误
	 */
	public static final String STATUS_CODE_RENAME_ERROE = "2007";
	/**
	 * 参数校验不通过
	 */
	public static final String STATUS_CODE_PARAMETERS_VALIDATE_ERROR = "2008";
	
	/**
	 * 帐户名密码错误
	 */
	public static final String STATUS_CODE_PWS_ERROR = "2009";
	
	/**
	 * 注册手机号已被使用
	 */
	public static final String STATUS_CODE_MOBILE_NUMBER_CONFLICT = "2011";
	
	
	/**
	 * 手机号在本系统中不存在
	 */
	public static final String STATUS_CODE_MOBILE_NUMBER_UNDEFINED = "2014";
	
	/**
	 * 微信-需要关联用户
	 */
	public static final String STATUS_CODE_WECHAT_ASSOCIATED_USER_ERROR="2804";
	
	/**
	 * 微信-关联失败
	 */
	public static final String STATUS_CODE_WECHAT_RELATION_ERROR="2805";
	
	/**
	 * 微信-用户已经关联
	 */
	public static final String STATUS_CODE_WECHAT_ALREADY_USER_ERROR="2806";
	
	/**
	 * 微信-openid已经关联
	 */
	public static final String STATUS_CODE_WECHAT_ALREADY_OPENID_ERROR="2807";
	
	/**
	 * 系统掷出类异常
	 */
	public static final String STATUS_CODE_SYS_EXCEPTION = "3001";
	
	/**
	 * 登陆验证码错误
	 */
	public static final String LOGIN_VERIFYCODE_ERROR = "2101";
	/**
	 * 未登录
	 */
	public static final String LOGIN_NOLOGIN_ERROR = "2102";
	
	/**
	 * 微信-获取code错误
	 */
	public static final String STATUS_CODE_WECHAT_CODE_ERROR="2801";
	

	/**
	 * 微信-获取access_token错误
	 */
	public static final String STATUS_CODE_WECHAT_ACCESS_TOKEN_ERROR="2802";
	
	/**
	 * 微信-获取用户信息错误
	 */
	public static final String STATUS_CODE_WECHAT_USERINFO_ERROR="2803";
	
	/**
	 *文章不存在 或者 不属于该用户
	 */
	public static final String STATUS_CODE_ARTICLE_USERINFO_ERROR="12804";
	
	/**
	 *文章分类名称重复
	 */
	public static final String STATUS_CODE_DUPLICATEKEY = "12805";

	/**
	 * 积分不足
	 */
	public static final String INTEGRAL_DEFICIENCY = "12806";
	
	/**
	 * 余额不足
	 */
	public static final String WITHDRAW_MONEY_DEFICIENCY = "12807";
	/**
	 *标签名称重复
	 */
	public static final String STATUS_CODE_TAG_DUPLICATEKEY = "12808";
	/**
	 * 未达到提现最小金额50
	 */
	public static final String WITHDRAW_MONEY_MIN = "12809";
	
	/**
	 手机号不一致
	 */
	public static final String TELNO_ERROR = "13001";
	
	/**
	 手机最大错误数3次
	 */
	public static final String MAX_ERROR = "13002";
	
	
	/**
	 * 系统异常
	 */
	public static String RESULT_CODE_SYSTEM_ERROR = "9999";
	
	public Object getAttribute(String key){
		return attribute.get(key);
	}
	
	public void setAttribute(String key, Object value){
		attribute.put(key, value);
	}
	
	public STATUS getStatus() {
		return status;
	}

	public void setStatus(STATUS status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Map<String, Object> getAttribute() {
		return attribute;
	}

	public void setAttribute(Map<String, Object> attribute) {
		this.attribute = attribute;
	}

	public String getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}
	
	
}
